package com.lrkj.payfee.service.impl;

import com.lrkj.common.utils.DateUtils;
import com.lrkj.payfee.domain.PayOrder;
import com.lrkj.payfee.mapper.PayOrderMapper;
import com.lrkj.payfee.service.IPayOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 费用支付订单Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-08-19
 */
@Service
public class PayOrderServiceImpl implements IPayOrderService {
    @Autowired
    private PayOrderMapper payOrderMapper;

    /**
     * 查询费用支付订单
     *
     * @param id 费用支付订单ID
     * @return 费用支付订单
     */
    @Override
    public PayOrder selectPayOrderById(String id) {
        return payOrderMapper.selectPayOrderById(id);
    }

    /**
     * 查询费用支付订单列表
     *
     * @param payOrder 费用支付订单
     * @return 费用支付订单
     */
    @Override
    public List<PayOrder> selectPayOrderList(PayOrder payOrder) {
        List<PayOrder> payOrders = payOrderMapper.selectPayOrderList(payOrder);
        return payOrders;
    }

    /**
     * 新增费用支付订单
     *
     * @param payOrder 费用支付订单
     * @return 结果
     */
    @Override
    public int insertPayOrder(PayOrder payOrder) {
        return payOrderMapper.insertPayOrder(payOrder);
    }

    /**
     * 修改费用支付订单
     *
     * @param payOrder 费用支付订单
     * @return 结果
     */
    @Override
    public int updatePayOrder(PayOrder payOrder) {
        payOrder.setUpdateTime(DateUtils.getNowDate());
        return payOrderMapper.updatePayOrder(payOrder);
    }

    /**
     * 批量删除费用支付订单
     *
     * @param ids 需要删除的费用支付订单ID
     * @return 结果
     */
    @Override
    public int deletePayOrderByIds(String[] ids) {
        return payOrderMapper.deletePayOrderByIds(ids);
    }

    /**
     * 删除费用支付订单信息
     *
     * @param id 费用支付订单ID
     * @return 结果
     */
    @Override
    public int deletePayOrderById(String id) {
        return payOrderMapper.deletePayOrderById(id);
    }

    /**
     * 批量新增费用支付订单信息
     *
     * @param payOrders 费用支付订单对象
     */
    public int batchAddData(List<PayOrder> payOrders) {
        return payOrderMapper.batchAddData(payOrders);
    }
}
